package com.hnkywl.sts.action.organ;

import com.hnkywl.sts.service.organ.LxrService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-3-25
 * Time: 下午3:48
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/organ/lxr")
public class LxrAction extends SimpleActionSupport {
    private LxrService lxrService;
    //联系人姓名
    private String xm;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    //企业法人id
    private Long lxrId;
    //远程ajax验证的值
    private String validateVal;
    //需要远程ajax验证的属性
    private String validateField;

    /**
     * 方法名:     获取联系人名称
     * 功能描述:      获取联系人名称列表
     * 异常:      <RuntimeException  Exception>
     * 创建人:     hfj
     * 创建日期:   13-2-19上午10:47
     * 修改人:     hfj
     * 修改日期:   13-2-19上午10:47
     */
    @Action("lxrList")
    public void lxrList() {
        this.renderJson(this.lxrService.findXm(xm, 0, -1));
    }

    /**
     * 是否选中正确的联系人提供的远程验证
     */
    @Action("ajax_contrary_validate")
    public void contraryValidate() {
        if (lxrService.ajaxValidate(lxrId, validateVal, validateField))
            renderJson("{\"valid\":true}");
        else
            renderJson("{\"valid\":false}");
    }
    //==================get and set ==========================

    public String getXm() {
        return xm;
    }

    public void setXm(String xm) {
        this.xm = xm;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public Long getLxrId() {
        return lxrId;
    }

    public void setLxrId(Long lxrId) {
        this.lxrId = lxrId;
    }

    public String getValidateVal() {
        return validateVal;
    }

    public void setValidateVal(String validateVal) {
        this.validateVal = validateVal;
    }

    public String getValidateField() {
        return validateField;
    }

    public void setValidateField(String validateField) {
        this.validateField = validateField;
    }

    @Autowired
    public void setLxrService(LxrService lxrService) {
        this.lxrService = lxrService;
    }


}
